package portal.monitor.dao.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import portal.monitor.dao.MonitorRelated;
import portal.monitor.dao.mapper.MonitorRelatedMapper;

import java.util.List;

@Service
public class MonitorRelatedService {

    @Autowired
    MonitorRelatedMapper monitorRelatedMapper;

    public Integer insert(MonitorRelated monitorRelated){
        return monitorRelatedMapper.insert(monitorRelated);
    }

    public Integer deleteByPrimaryKey(int relatedId){
        return monitorRelatedMapper.deleteByPrimaryKey(relatedId);
    }
    public Integer deleteByHostId(Integer... hostId){
        int count = 0;
    	for(int i :hostId){
    		count += monitorRelatedMapper.deleteByHostId(i);
    	}
        return count;
    }
    public Integer deleteByGroupId(Integer... groupId){
    	int count = 0;
    	for(int i :groupId){
    		count += monitorRelatedMapper.deleteByGroupId(i);
    	}
        return count;
    }

    public Integer updateByPrimaryKey(MonitorRelated monitorRelated){
        return monitorRelatedMapper.updateByPrimaryKey(monitorRelated);
    }

    public MonitorRelated selectByPrimaryKey(int relatedId){
        return monitorRelatedMapper.selectByPrimaryKey(relatedId);
    }
    public  List<MonitorRelated> selectByHostId(int hostId){
        return monitorRelatedMapper.selectByHostId(hostId);
    }

    public List<MonitorRelated> selectAll(){
        return monitorRelatedMapper.selectAll();
    }
    
    public List<MonitorRelated> selectByGroupId(int groupId){
    	return monitorRelatedMapper.selectByGroupId(groupId);
    }
}
